using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_VisitestatMap : EntityTypeConfiguration<so_Visitestat>
    {
        public so_VisitestatMap()
        {
            // Primary Key
            this.HasKey(t => new { t.SUMFIELDS, t.DimFIELDS });

            // Properties
            this.Property(t => t.Attending_physician)
                .HasMaxLength(35);

            this.Property(t => t.Guarantor_1)
                .HasMaxLength(60);

            this.Property(t => t.Guarantor_2)
                .HasMaxLength(60);

            this.Property(t => t.Month)
                .HasMaxLength(2);

            this.Property(t => t.Year)
                .HasMaxLength(4);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(14);

            this.Property(t => t.DimFIELDS)
                .IsRequired()
                .HasMaxLength(36);

            // Table & Column Mappings
            this.ToTable("so_Visitestat");
            this.Property(t => t.Attending_physician).HasColumnName("Attending_physician");
            this.Property(t => t.Guarantor_1).HasColumnName("Guarantor_1");
            this.Property(t => t.Guarantor_2).HasColumnName("Guarantor_2");
            this.Property(t => t.Visits_Count).HasColumnName("Visits_Count");
            this.Property(t => t.Month).HasColumnName("Month");
            this.Property(t => t.Year).HasColumnName("Year");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DimFIELDS).HasColumnName("DimFIELDS");
        }
    }
}
